/*    */ package com.infoservice.schedule.util;
/*    */ 
/*    */ import com.infoservice.schedule.queue.TaskBean;
/*    */ import java.io.PrintStream;
/*    */ import java.text.SimpleDateFormat;
/*    */ import java.util.Calendar;
/*    */ import java.util.Date;
/*    */ import java.util.regex.Matcher;
/*    */ import java.util.regex.Pattern;
/*    */ import org.apache.log4j.Logger;
/*    */ 
/*    */ public class TaskUtils
/*    */ {
/* 34 */   private static Logger logger = Logger.getLogger(TaskUtils.class);
/*    */ 
/*    */   public static boolean checkTimeRange(Date planDate, String start, String end)
/*    */   {
/* 46 */     Calendar startDate = getCalendar();
/* 47 */     startDate.setTime(planDate);
/* 48 */     String[] hm2 = start.split(":");
/* 49 */     startDate.set(11, Integer.parseInt(hm2[0]));
/* 50 */     startDate.set(12, Integer.parseInt(hm2[1]));
/*    */ 
/* 52 */     Calendar endDate = getCalendar();
/* 53 */     endDate.setTime(planDate);
/* 54 */     String[] hm = end.split(":");
/* 55 */     endDate.set(11, Integer.parseInt(hm[0]));
/* 56 */     endDate.set(12, Integer.parseInt(hm[1]));
/* 57 */     if (endDate.getTimeInMillis() == startDate.getTimeInMillis())
/* 58 */       return true;
/* 59 */     if (endDate.getTimeInMillis() < startDate.getTimeInMillis()) {
/* 60 */       endDate.setTimeInMillis(endDate.getTimeInMillis() + 86400000L);
/*    */     }
/* 62 */     logger.debug("planDate======" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(planDate));
/* 63 */     logger.debug("startDate======" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startDate.getTime()));
/* 64 */     logger.debug("endDate======" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endDate.getTime()));
/* 65 */     return (startDate.getTimeInMillis() <= planDate.getTime()) && (planDate.getTime() <= endDate.getTimeInMillis());
/*    */   }
/*    */   public static Calendar getCalendar() {
/* 68 */     Calendar cur = Calendar.getInstance();
/* 69 */     cur.set(14, 0);
/* 70 */     cur.set(13, 0);
/* 71 */     return cur;
/*    */   }
/*    */   public static boolean validateTaskPlanParamters(TaskBean tb) {
/* 74 */     String timePattern = "([0-1]?[0-9]|2[0-3]):([0-5][0-9])";
/* 75 */     String datePattern = "(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)";
/* 76 */     String weekPattern = "W[1-7]";
/* 77 */     String monthPattern = "M1|M30";
/* 78 */     String mdPattern = "([0-9]|1[0-2]])-([0-9]|1[0-9]|2[0-9]|3[0-1])";
/* 79 */     return false;
/*    */   }
/*    */ 
/*    */   public static void main(String[] args)
/*    */   {
/* 85 */     Pattern weekPattern = Pattern.compile("([0-1]?[0-9]|1[0-2]])-([0-3]?[0-9]|1[0-9]|2[0-9]|3[0-1])");
/* 86 */     Matcher matcher2 = weekPattern.matcher("11-31");
/* 87 */     System.out.println(matcher2.matches());
/*    */   }
/*    */ }

/* Location:           D:\Workspace\Work\ASMP_DE\lib\frame3\InfoSchedule_1.0.03.jar
 * Qualified Name:     com.infoservice.schedule.util.TaskUtils
 * JD-Core Version:    0.6.0
 */